# Maintainer: Jaroslav Lichtblau <svetlemodry@archlinux.org>
# Contributor: Geoffroy Carrier <geoffroy.carrier@aur.archlinux.org>
# Contributor: Marco Bartholomew <marco@marcobartholomew.com>

pkgname=monit
pkgver=5.33.0
pkgrel=1
pkgdesc="Utility for managing and monitoring, processes, files, directories and devices on a *NIX system"
arch=('loong64' 'x86_64')
url="https://mmonit.com/monit/"
license=('GPL3')
depends=('openssl')
backup=('etc/monitrc')
changelog=$pkgname.changelog
source=(https://mmonit.com/$pkgname/dist/$pkgname-$pkgver.tar.gz)
sha256sums=('1ace889c0183473a9d70160df6533bb6e1338dc1354f5928507803e1e2a863b5')

build() {
  cd "${srcdir}"/$pkgname-$pkgver

  ./configure --prefix=/usr --sysconfdir=/etc
  make
}

package() {
  cd "${srcdir}"/$pkgname-$pkgver

  make DESTDIR="${pkgdir}" install

  install -Dm700 monitrc "${pkgdir}"/etc/monitrc
  install -Dm644 system/startup/$pkgname.service "${pkgdir}"/usr/lib/systemd/system/$pkgname.service
}
